package ipt.capitulo19;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.html.*;
import javax.swing.JEditorPane.*;
import java.net.URL;
public class VigilaEnlaces implements HyperlinkListener{
	ExploradorHTML apl;
	VigilaEnlaces(ExploradorHTML apl){
		this.apl=apl;
	}
	public void hyperlinkUpdate(HyperlinkEvent e){
		HyperlinkEvent.EventType tipo = e.getEventType();
		if(tipo == HyperlinkEvent.EventType.ACTIVATED)
			try{
				apl.jeditorpane.setPage(e.getURL());
				apl.barraBotones.urlTexto.setText(e.getURL().toString());
				apl.lF.leeFicheroURL(e.getURL(),apl.htmlTexto);
				apl.carpeta.repaint();
			}catch(Exception ex){
				System.out.println("Error en la URL "+e.getURL());
			}
	}
}
